{% extends 'base.html' %}
{% block content%}

{% for item in object_list %}
        <h4 style="color:green;">{{item.title}} </h4>
        <p> {{ item.body|safe|slice:":1000"}}...<a href={{ item.get_absolute_url }}>подробнее</a></p>
        <table style="width:700px; border:1px solid black;"><tr><td style="text-align:left; padding-left:10px;"><span>Категория:&nbsp;<a href="{% url news_list %}{{ item.category.slug }}">{{ item.category }}</a>
        {% if request.user in item.category.operator.all or request.user.is_superuser %}
        |&nbsp;<a href="/news/update/{{ item.id }}">Редактировать новость</a></span>{% endif %} </td><td><strong style="float:right; padding-right:10px;">{{ item.date.date }}</strong></td></tr></table>


    {% empty %}
        Новостей нет
{% endfor %}



{% if is_paginated %}
    <div class="pagination">
        <span class="step-links">
            {% if page_obj.has_previous %}
                <a href="?page={{ page_obj.previous_page_number }}">назад</a>
            {% endif %}

            <span class="current">
                Страница {{ page_obj.number }} из {{ paginator.num_pages }}.
            </span>

            {% if page_obj.has_next %}
                <a href="?page={{ page_obj.next_page_number }}">вперед</a>
            {% endif %}
        </span>
    </div>
{% endif %}

{% endblock %}